#coding=utf-8

# class SSR(Exception):
    
#     def __init__(self):
#         pass


# try:
#     a = input("请输入。")
#     if len(a) < 3:
#         raise SSR()
# except EOFError: 
#     print("ss")
# except SSR:   
#     print("产生了一个异常")
# else:
#     print("没有异常........。。....。。。     ")
# finally:
#     print("最后必须执行的")

#异常处理中抛出异常
class Test(object):

    def __init__(self,switch):
        self.switch = switch
    def calc(self,a,b):
        try:
            return a/b
        except Exception as result:
            if self.switch:
                print("捕获已开启")
                print(result)
            else:
                
                raise

a = Test(True)
a.calc(11,0)
print("="*30)
a.switch = False
a.calc(11,0)